<template>
    <div>
        <Header />
        <div class="indexContainer">
            <div class="mapNav">
                <el-breadcrumb separator-class="el-icon-arrow-right">
                    <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
                    <el-breadcrumb-item>产品申请成功页</el-breadcrumb-item>
                </el-breadcrumb>
            </div>
            <div class="applyResult">
                <h3 class="applyTitle">申请提交成功，请等待审核！订单号：{{id}}</h3>
                <!-- 表单 -->
                <div class="shopTop">
                    <!-- <div class="shopBtn">
                        <span></span>
                        <el-checkbox v-if="shopData.length !== 0" v-model="isSelectAll" @change="selectAll">全选</el-checkbox>
                    </div> -->
                    <p class="tableOne">商品简介</p>
                    <p class="tableTwo">上架时间</p>
                    <p class="tableThree">价格</p>
                    <p class="tableFour">状态</p>
                </div>
                <!-- 选中的列表 -->
                <div class="shopList">
                    <el-empty :image-size="100" v-if="shopData.length == 0" description="暂无数据"></el-empty>
                    <ul>
                        <li v-for="item in shopData" :key="item.id">
                            <!-- <div class="listBtn" style="width:3%;">
                                <span style="display: inline-block;"></span>
                            </div> -->
                            <div class="listOne leftOne">
                                <div class="goodInfo">
                                    <img class="goodImg" :src="item.productModel.thumbnail" alt="">
                                    <div class="goodDesc">
                                        <h3 class="singleLine" @click="handleProDetail(item.productModel.id)">{{ item.productModel.title }}</h3>
                                        <p class="moreLineThree">{{ item.productModel.description }}
                                        </p>
                                    </div>
                                    <div class="goodType">
                                        <div class="typeItem">
                                            <p>{{ item.productModel.source == 1 ? '内部产品' : '外部产品' }}</p>
                                            <p>{{ item.productModel.categoryName }}</p>
                                        </div>
                                        <p class="supplierText singleLine">供应商：{{ item.productModel.supplier }}</p>
                                    </div>
                                </div>
                            </div>
                            <p class="listTwo">{{ item.shelfTime }}</p>
                            <p class="listThree">{{ item.consumName ? item.consumName : 0 }}</p>
                            <p class="listFour">
                                <span>审核中</span>
                            </p>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        <Footer />
    </div>
</template>
<script>
import Header from "@/components/home/header/header";
import Footer from "@/components/home/footer/footer";
import { dateFormat } from "@/utils/dateFormat.js"
import { shopOrderAdd } from "@/request/api/shopCart"
export default {
    components: {
        Header,
        Footer
    },
    data() {
        return {
            shopData: [],
            id: this.$route.query.id,
            userInfo:{}
        }
    },
    created() {
        this.iSgetPro()
    },
    methods: {
        //是否获取到信息
        iSgetPro() {
            if (window.sessionStorage.getItem("dataArray") !== null) {
                this.shopData = JSON.parse(window.sessionStorage.getItem("dataArray"));
                this.userInfo = JSON.parse(window.sessionStorage.getItem("userInfo"));
            }
        },
         // 产品详情
         handleProDetail(id) {
            this.$router.push({
                name: "ApplicationProductsDetail",
                query: {
                    id,
                    userId: this.userInfo.id
                }
            });
        },
        // 提交申请
        handleSubmit() {
            this.$refs.form.validate((valid) => {
                if (valid) {
                    this.$confirm("是否确认提交申请?", "提示", {
                        confirmButtonText: "确定",
                        cancelButtonText: "取消",
                        type: "warning",
                    }).then(() => {
                        shopOrderAdd(this.form).then((res) => {
                            if (res.data.code === 1) {
                                this.$message({
                                    message: '申请提交成功！',
                                    type: "success",
                                });
                                this.$router.push({
                                    name: "applyResult",
                                    query: {
                                        id:res.data.data,
                                    },
                                });
                                this.bus.$emit("shopCount");//删除成功后，重新调用购物车数量接口
                            } else {
                                this.$message.error(res.data.message);
                            }
                        });
                    })
                }
            })
        },
    }
}
</script>
<style lang="less" scoped>
@import "./shopCart.less";
</style>


